import Vue from "vue"
import Vuex from "vuex"
Vue.use(Vuex);


const store = new Vuex.Store({
    state:{
        loginUser:{
            loging:false,
            user:null
        },
        login:false,
        books:{
            rows:null,
            count:null

        },
        toPath:'/',
        detalist:false,
        userInfo:null,
        detalistBook:null
       
    },
    mutations:{
       setUser(state,payload){
           state.loginUser.user  = payload;
       } ,
       setLogin(state,payload){
           state.loginUser.loging = payload;
       },
       setLoginGui(state,payload){
            state.login = payload;
       },
       setBooksRows(state,payload){
           state.books.rows=payload;
       },
       setBooksCount(state,payload){
        state.books.count= payload;
       },
       setToPath(state,payload){
           state.toPath = payload;
       },
       setDetalist(state,payload){
        state.detalist = payload;
       },
       setUserInfo(state,payload){
           state.userInfo = payload;
       },
       setDetalistBook(state,payload){
           state.detalistBook = payload;
       }
    },
    actions:{
        
    },
    getters:{
        getDetalist:(state,getters)=>{
            return state.detalist;
        },
        getUserInfo(state,getters){
            return state.userInfo;
        }
    }
});
window.store = store;
export default store 